<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'私家之旅',
	'language' => 'zh-CN',

	// 预载入log（记录）应用组件，这表示该应用组件无论它们是否被访问都要被创建
	'preload'=>array('log'),

	// 自动载入的模型和组件类
	'import'=>array(
		'application.models.*',//载入“application/models/”文件夹下的所有模型类
		'application.components.*',
		//载入支付宝插件
		'application.extensions.alipay.*',
	),
	//设置默认控制器类
	'defaultController'=>'Home',

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		/*
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'Enter Your Password Here',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		*/
	),

	// 当前应用的组件配置。更多可供配置的组件详见下面的“核心应用组件”
	'components'=>array(
		//user（用户）组件配置，“user”为组件ID 
		'user'=>array(
			// 可以使用基于cookie的认证
			'allowAutoLogin'=>true,
		),

		// uncomment the following to enable URLs in path-format
		/*
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
		*/

		// 数据库配置
		'db'=>require(dirname(__FILE__).'/database.php'),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'home/error',
		),

		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				//Yii::log('your message', 'warning', 'models.base.error');
				//全局日志文件
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				//模型层日志文件
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
					'categories'=> 'models.*',  
					'logFile'=> date("Y-m-d").'-models.log.txt', 
				),
				//支付日志文件
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
					'categories'=> 'pays.*',  
					'logFile'=> date("Y-m-d").'-pays.log.txt', 
				),
			),
		),
		//session设置
		'session'=>array(
		   'autoStart'=>true,
		   'sessionName'=>'PHPSESSIONID',
		   'cookieMode'=>'only',
		   'savePath'=>dirname(__FILE__)."/../data/session",
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'sunnyboy177@sina.com',
		'qqContant' => "location.href='tencent://message/?uin=2233760400&Site=qq&Menu=yes'",
		'weiboUrl' => 'http://weibo.com/p/1005055200874952',
		//错误编码配置
		'errorCode' => require(dirname(__FILE__).'/error.php'),
		//支付宝配置
		'alipay' => require(dirname(__FILE__).'/alipay.php'),
		//版本
		'version'=> require(dirname(__FILE__).'/version.php')
	),
);
